package com.ccp.dev.qbdms.dao;

import com.ccp.dev.core.basic.base.IBaseMapper;
import com.ccp.dev.qbdms.model.WQbdMyPushRecord;
import org.apache.ibatis.annotations.Mapper;
import com.ccp.dev.core.basic.web.query.QueryFilter;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 推送记录 信息数据库操作类
 *
 * @author hw
 * @date 2020-07-29 14:04:44
 */
@Mapper
public interface WQbdMyPushRecordDao extends IBaseMapper<WQbdMyPushRecord,String> {

    List<WQbdMyPushRecord> queryAll(QueryFilter queryFilter);

    @Select("select * from w_qbd_my_push_record where userId=#{userId} AND knowledge_id =#{tzId}")
    WQbdMyPushRecord findByUserIdandTzid(@Param(value = "userId") String userId, @Param(value = "tzId") String tzId);

    /**
     * 获取当前登录用户所需要推送的消息
     * @param userId 用户id
     * @return
     */
    List<WQbdMyPushRecord> needPushRecord(@Param("userId")String userId);

    /**
     * 根据用户id与知识id查询数据信息
     * @param userId
     * @param id
     * @return
     */
    WQbdMyPushRecord getPushRecordByData(@Param("userId")String userId, @Param("knowledgeId")String id);

    /**
     * 当用户点击详情查看时,更新该数据状态
     * @param id
     */
    void updateStatusByData(@Param("id")String id);
}
